<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>
<h:body>
<h:panelGroup rendered="#{sessaoMB.usuario.professor}" >
	<f:view>
		<ui:include src="topo.xhtml"></ui:include>
	</f:view>
	
	<div class="container">
		<div class="navegacao">&nbsp;&nbsp;&nbsp; Inicio:</div>

		<div class="conteudo">

			<h:form id="form">
				<p:growl showDetail="true"></p:growl>
				<p:dataTable var="reserva" value="#{listarReservaMB.lista}"
					rowKey="#{reserva}" paginator="true" rows="7"
					selection="#{listarReservaMB.reserva}" selectionMode="single"
					filteredValue="#{listarReservaMB.filteredReservas}"
					id="reservasTable">

					<f:facet name="header">Lista de Reservas a Confirmar</f:facet>

					<p:column headerText="Professor" sortBy="#{reserva.reserva_PK.curso.nome}" filterBy="#{reserva.reserva_PK.curso.nome}" 
					id="cpf">#{reserva.reserva_PK.usuario.nome} </p:column>

					<p:column headerText="Equipamento" sortBy="#{reserva.reserva_PK.equipamento.nome}"
						filterBy="#{reserva.reserva_PK.equipamento.nome}" id="year"> #{reserva.reserva_PK.equipamento.nome}</p:column>

					<p:column headerText="Data" id="manufacturerData">
						<h:outputText value="#{reserva.reserva_PK.data_da_reserva}">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column headerText="Hora" id="manufacturerHora">
						<h:outputText value="#{reserva.reserva_PK.data_da_reserva}">
							<f:convertDateTime pattern="HH:mm" timeZone="Brazil/East" />
						</h:outputText>
					</p:column>

					<p:column headerText="Ativo">#{reserva.ativo} </p:column>

					<p:column headerText="Editar">
						<p:commandButton icon="ui-icon-pencil"
							action="#{listarReservaMB.editarReserva(reserva)}"></p:commandButton>
					</p:column>

					<p:column headerText="Remover">
						<p:commandButton icon="ui-icon-trash"
							actionListener="#{listarReservaMB.removerReserva(reserva)}"
							update=":form"></p:commandButton>
					</p:column>
				</p:dataTable>
			</h:form>
			
		</div>
	</div>

	<div class="rodape">
		<ui:include src="/rodape.xhtml"></ui:include>
	</div>
	</h:panelGroup>
</h:body>
</html>